<template>
    <view>

    </view>
</template>

<script>
import BpmApi from "@/api/rxBpm/bpmInst.js";

export default {
    name: "openInst",
    props: {},
    data() {
        return {}
    },
    created() {
        var item = this.routes();
        this.navigateTo(this.$route.query);
    },
    methods: {
        bpmDetails(obj,action) {
            let params = {
                instId: obj.instId,
                routerName:'openDoc',
                action:action
            }
            if(obj.taskId){
                params.taskId = obj.taskId;
            }
            let mobileAppId = uni.getStorageSync("mobileAppId");
            let appId =''
            if(obj.appId){
                appId=obj.appId?obj.appId:mobileAppId
            }
            uni.navigateTo({
                url:'/views/modules/bpm/OpenDoc?params='+ JSON.stringify(params) +"&appId="+appId
            })
        },
        navigateTo(item) {
            let self = this;
            console.log("---待办已办跳转：navigateTo item==" + JSON.stringify(item));
            BpmApi.getInfoByDefKeyInstId("openDoc", item.instId).then(res => {
                console.log("---待办已办跳转：res==" + JSON.stringify(res));
                if (res.action == "task") {
                    self.bpmDetails(res,'edit');
                }
                if (res.action == "detail") {
                    self.bpmDetails(res,'detail');
                }
            });
        }
    },
    watch: {}
}
</script>

<style scoped>

</style>
